# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Contributor: xucaiming <719260170@qq.com>
# Maintainer: xucaiming <719260170@qq.com>

cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(pvmp3dec
        VERSION 1.0.1
        LANGUAGES C CXX)



set(SRC
        src/pvmp3_normalize.cpp
        src/pvmp3_alias_reduction.cpp
        src/pvmp3_crc.cpp
        src/pvmp3_decode_header.cpp
        src/pvmp3_decode_huff_cw.cpp
        src/pvmp3_getbits.cpp
        src/pvmp3_dequantize_sample.cpp
        src/pvmp3_framedecoder.cpp
        src/pvmp3_get_main_data_size.cpp
        src/pvmp3_get_side_info.cpp
        src/pvmp3_get_scale_factors.cpp
        src/pvmp3_mpeg2_get_scale_data.cpp
        src/pvmp3_mpeg2_get_scale_factors.cpp
        src/pvmp3_mpeg2_stereo_proc.cpp
        src/pvmp3_huffman_decoding.cpp
        src/pvmp3_huffman_parsing.cpp
        src/pvmp3_tables.cpp
        src/pvmp3_imdct_synth.cpp
        src/pvmp3_mdct_6.cpp
        src/pvmp3_dct_6.cpp
        src/pvmp3_poly_phase_synthesis.cpp
        src/pvmp3_equalizer.cpp
        src/pvmp3_seek_synch.cpp
        src/pvmp3_stereo_proc.cpp
        src/pvmp3_reorder.cpp
        src/pvmp3_polyphase_filter_window.cpp
        src/pvmp3_mdct_18.cpp
        src/pvmp3_dct_9.cpp
        src/pvmp3_dct_16.cpp)

        
add_definitions(-DOSCL_UNUSED_ARG=)
add_library(pvmp3dec STATIC ${SRC})

target_include_directories(pvmp3dec
        PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>
        PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>)

set_target_properties(pvmp3dec PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES src/pvmp3_dec_defs.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(TARGETS pvmp3dec DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)